import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Window;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.awt.event.MouseWheelEvent;
import java.awt.event.MouseWheelListener;


public class MouseInput extends Core implements KeyListener, MouseListener, MouseMotionListener, MouseWheelListener{
	public static void main(String[] args){
		new MouseInput().run();
	}
	
	private String mess = "";
	
	//init calss super init
	public void init(){
		super.init();
		Window w = s.getFullScreenWindow();
		w.addMouseListener(this);
		w.addMouseMotionListener(this);
		w.addMouseWheelListener(this);
		w.addKeyListener(this);
	}
	
	//draw
	public synchronized void draw(Graphics2D g){
		Window w = s.getFullScreenWindow();
		g.setColor(w.getBackground());
		g.fillRect(0, 0, s.getWidth(), s.getHeight());
		g.setColor(w.getForeground());
		g.drawString(mess, 40, 50);
	}
	
	//mouse listener interface
	public void mousePressed(MouseEvent e){
		mess = "you pressed down the mouse";
	}
	public void mouseReleased(MouseEvent e){
		mess = "you released down the mouse";
	}
	public void mouseClicked(MouseEvent e){}
	public void mouseEntered(MouseEvent e){}
	public void mouseExited(MouseEvent e){}
	
	//mouse motion interface
	public void mouseDragged(MouseEvent e){
		mess = "you ard dragging the mouse";
	}
	
	public void mouseMoved(MouseEvent e){
		mess = "you ard moviing the mouse";
	}
	
	//wheel interface
	public void mouseWheelMoved(MouseWheelEvent e){
		mess = "moviing mouse wheel";
	}
	
	//key pressed
	@Override
	public void keyPressed(KeyEvent e){
		int keyCode = e.getKeyCode();
		if(keyCode == KeyEvent.VK_ESCAPE){
			stop();
		}
		else{
			mess = "Pressed : " + KeyEvent.getKeyText(e.getKeyCode());
			e.consume();
		}
	}
	
	//key released
	public void keyReleased(KeyEvent e){
		int keyCode = e.getKeyCode();
		mess = "Released : " + KeyEvent.getKeyText(e.getKeyCode());
		e.consume();
	}

	@Override
	public void keyTyped(KeyEvent e) {
		e.consume();
	}

}